<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../../sources/jq/jq.js"></script>
</head>
<body>
<form>
    <label for="account">账户</label><input type="text" id="account">
    <br>
    <label>密码</label><input type="password"  name="pwd">
    <br>
    <label>确认密码</label><input type="password" name="repwd">
    <br>
    <label>爱好</label>
    <label for="math">数学</label><input type="checkbox" name="favor" id="math">
    <label for="astronomy">天文</label><input type="checkbox" name="favor" id="astronomy">
    <label for="philosophy">哲学</label><input type="checkbox" name="favor" id="philosophy">
    <label for="physics">物理</label><input type="checkbox" name="favor" id="physics">
    <label for="all_selected">全选</label><input type="checkbox" id="all_selected">
    <br>
    <button id="submit">提交</button>
</form>

<script>
    let selectAll = $('#all_selected');
    //被点击后
    selectAll.click(function () {
        if(selectAll.prop('checked') === true){
            $(":checkbox").prop("checked", true);
        }else{
            $(":checkbox").prop("checked", false);
        }
    });
    let submit = $('#submit');
    submit.click(function () {
        let password = $(':password');
        let pwd = password[0].value;
        let repwd = password[1].value;
        if(pwd.length === 0 || pwd ===null || pwd === undefined || pwd !== repwd){
            alert('密码错误');
        }
    })
</script>
</body>
</html>